//
//  AZHomeFourthCell.swift
//  AzaanSwift
//
//  Created by Azzan on 2018/4/14.
//  Copyright © 2018年 Azzan. All rights reserved.
//

import UIKit

class AZHomeFourthCell: UITableViewCell {

    @IBOutlet weak var icon: UIImageView!
    @IBOutlet weak var titalLB: UILabel!
    @IBOutlet weak var goodsNumLB: UILabel!
    @IBOutlet weak var percentView: UIView!
    @IBOutlet weak var priceLB: UILabel!
    @IBOutlet weak var priceLB2: UILabel!
    @IBOutlet weak var percentBackView: UIView!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    //进度
    @IBInspectable var percent: Int = 0 {
        didSet {
            if percent > 100 {
                percent = 100
            }else if percent < 0 {
                percent = 0
            }
            setNeedsLayout()
        }
    }
    
    //布局相关设置
    override func layoutSubviews() {
        super.layoutSubviews()
        
        var barFrame = percentBackView.frame
        barFrame.size.width *= (CGFloat(self.percent) / 100)
        percentView.frame = barFrame
    }
    
    
    @IBAction func buyNow(_ sender: UIButton) {
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
